<?php

include_once('config.php');

!isset($_GET['m'])?$_GET['m'] = '':$_GET['m'];

if(MODULE == 'none' && $_GET['m'] == ''){
	
	include(PUNG_ROOT . '/system/header.php');
	
	is_dir('install/') ? print ('<h1 style="text-align:center;color:red;">'.LANG_127.'</h1>') : '' ;
	
	if($db->check_table(DB_PREFIX.'index')){
		
		$db->db_query('SELECT * FROM '.DB_PREFIX.'index');
		
		$index = $db->db_result();
		
		$content = $index[0]['content'];
		
	}else{
		
		$content = LANG_139;
					
	}
	
	include(PUNG_ROOT . '/system/footer.php');
	
}else{
	
	ob_start();
	
	if($_GET['p'] == '')
	{
		include('modules/'.$_GET['m'].'/index.php');
	}
	else
	{
		$modpath = 'modules/'.$_GET['m'].'/'.$_GET['p'].'.php';
		if(file_exists($modpath))
		{
			include($modpath);	
		}
		else
		{
			
			include(PUNG_ROOT . '/system/header.php');
	
			$content 	 = LANG_138;
			
			include(PUNG_ROOT . '/system/footer.php');
			
		}
	}
	
	$content = ob_get_contents();
	
	ob_end_clean();
	
	print $content;
	
}

?>